@(resourceForm: Form[Resource], groups : Seq[(String, String)])

@import helper._
@import helper.twitterBootstrap._

@main {
    <fieldset>
      <legend>@Messages("res.form.heading")</legend>
      
      @if(resourceForm.hasErrors) {
          <div class="alert-message error">
              <p><strong>Oops</strong> @Messages("msg.err.heading") </p>
              <dl>
                  @for(ferror <- resourceForm.errors) {
                      <dt>
                          @Messages("msg.err.fld.lbl") @ferror.key
                      </dt>
                      <dd>@Messages("msg.err.msg.lbl") @ferror.message</dd>
                  }
              </dl>
          </div>
      }

      @form(routes.Resources.submit, 'class -> "form-horizontal") {
          <input type="hidden" name="id" value='@resourceForm("id").value' />        
          
              @inputText(resourceForm("name"), 'id -> "name", 'size -> 30, '_label -> Messages("res.name.lbl"))
              @inputText(resourceForm("version"), 'id -> "version", 'size -> 30, '_label -> Messages("res.version.lbl"))
              @inputText(resourceForm("uri"), 'id -> "uri", 'size -> 30, '_label -> Messages("res.uri.lbl"))
              @select(
                  resourceForm("group"), 
                  groups, 
                  '_label -> Messages("res.grp.lbl"), 'id -> "group", '_default -> Messages("res.grp.default"),
                  '_showConstraints -> false
              )

          <div class="actions">
              <input type="submit" value='@Messages("save.btn")' class="btn primary"> or 
              <a href="@routes.Resources.list()" class="btn">@Messages("cancel.btn")</a> 
          </div>
          
      }
      
      @if(resourceForm("id").value.isDefined) {
        @form(routes.Resources.delete(resourceForm("id").value.get.toLong), 'class -> "topRight") {
          <input type="submit" value='@Messages("delete.btn")' class="btn danger">
        }
      }    
    </fieldset>
}
